home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 1284 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.0 KB  |  53 lines

  1. Newsgroups: comp.lang.c
  2. Path: howland.reston.ans.net!psinntp!psinntp!psinntp!psinntp!scisun!sergio
  3. From: sergio@sci.ccny.cuny.edu (Sergio Rojas)
  4. Subject: What is wrong in this code?
  5. Message-ID: <DL2z7o.2K5@scisun.sci.ccny.cuny.edu>
  6. Sender: usenet@scisun.sci.ccny.cuny.edu
  7. Organization: City College Of New York - Science
  8. X-Newsreader: TIN [version 1.2 PL2]
  9. Date: Fri, 12 Jan 1996 18:26:12 GMT
  10.  
  11. Hello Fellows,
  12.  
  13.   I am traying to be literate in C and here is a
  14. problem wich I have been unable to detect:
  15.  
  16. #include <stdio.h>
  17. #include <math.h>
  18. main()
  19. {
  20. double x;
  21.  
  22. printf("\n Enter a number \n");
  23.  
  24. scanf("%f", &x);
  25.  
  26. printf("\n %e to the power %e is equal to   ", x , x );
  27.  
  28. x = pow(x,x); 
  29.  
  30. printf(" %12.6f \n", x );
  31.  
  32. }
  33.  
  34. Some output are as follows:
  35.  
  36.  Enter a number 
  37. 2
  38.  
  39.  2.000000e+00 to the power 2.000000e+00 is equal to        4.000000 
  40. scisun{sergio}121% a.out
  41.  
  42.  Enter a number 
  43. 3
  44.  
  45.  3.200000e+01 to the power 3.200000e+01 is equal to    1461501637330902918203684832716283019655932542976.000000 
  46.  
  47.  
  48.   Thanks for your comments,
  49.  
  50. rojas
  51. Email: sergio@scisun.sci.ccny.cuny.edu
  52.  
  53.